/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cr.ac.una.sive.managed;

import cr.ac.una.sive.entidad.TipoMarchamo;
import cr.ac.una.sive.sessionbean.TipoMarchamoFacadeLocal;
import cr.ac.una.sive.entidadLocal.TipoMarchamoLocal;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.SelectItem;

/**
 *
 * @author claribel
 */
@ManagedBean
@RequestScoped
public class TipoMarchamoFacadeManaged {
    @EJB(mappedName = "ejb/TipoMarchamoFacade")
    private TipoMarchamoFacadeLocal tipoMarchamoFacade;

    
    
    private TipoMarchamoLocal tipoMarchamoLocal = new TipoMarchamoLocal();

    public TipoMarchamoLocal getTipoMarchamoLocal() {
        return tipoMarchamoLocal;
    }

    public void setTipoMarchamoLocal(TipoMarchamoLocal tipoMarchamoLocal) {
        this.tipoMarchamoLocal = tipoMarchamoLocal;
    }
    
    public ArrayList getListaTiposMarchamos() {        
       
        List<TipoMarchamo> listaTipos = tipoMarchamoFacade.findAll();
        tipoMarchamoLocal.getListaTiposMarchamo().clear();

        for(int i=0; i<listaTipos.size(); i++)
        {
            TipoMarchamo col = new TipoMarchamo();
            col = (TipoMarchamo)listaTipos.get(i);
           
            tipoMarchamoLocal.getListaTiposMarchamo().add(new SelectItem(col,col.getNombre()));
        }      
       
        return tipoMarchamoLocal.getListaTiposMarchamo();
    }
    /**
     * Creates a new instance of TipoMarchamoFacadeManaged
     */
    public TipoMarchamoFacadeManaged() {
    }
}
